package com.sumer.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 线程池
 */
public class ThreadPool {
    public static void main(String[] args) {
        // 1.创建线程池
        ExecutorService executorService = Executors.newFixedThreadPool(10);
        MyThread myThread = new MyThread();
        // 2.执行
        executorService.execute(myThread);
        // 3.关闭连接
        executorService.shutdown();
    }
}

class MyThread implements Runnable{

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName());
    }
}
